import { BasicComponent } from './basic/basic.component';
import { Demo2Component } from './demo2/demo2.component';
import { CustomComponent } from './custom/custom.component';
import { MultilineComponent } from './multiline/multiline.component';
import { SaveFilterComponent } from './save-filter/save-filter.component';

export const AdvancedFilterConfig = {
  location: 'AdvancedFilter',
  description: '高级筛选器。',
  description_en: 'AdvancedFilter.',
  component: [
    {
      demo: BasicComponent,
      codePath: 'showcase/advanced-filter/basic/basic.component',
      demoTitle: '基本',
      demoTitle_en: 'Basic',
      demoDescription: '基本用法，提供单选、多选等多种类型，适用于需要反复添加修改筛选项才能找到对应目标的场景。',
      demoDescription_en:
        'Basic usage. It provides multiple types such as single selection and multiple selection. It is applicable to scenarios where you need to add and modify filter items repeatedly to find the corresponding target.',
    },
    {
      demo: MultilineComponent,
      codePath: 'showcase/advanced-filter/multiline/multiline.component',
      demoTitle: '多行筛选标签',
      demoTitle_en: 'Multiline filter label',
      demoDescription: '多行筛选标签。',
      demoDescription_en: 'Multiline filter label.',
    },
    {
      demo: SaveFilterComponent,
      codePath: 'showcase/advanced-filter/save-filter/save-filter.component',
      demoTitle: '保存筛选',
      demoTitle_en: 'Save Filter',
      demoDescription: '保存当前筛选条件为模板',
      demoDescription_en: 'Save the current filters as a template.',
    },
    {
      demo: Demo2Component,
      codePath: 'showcase/advanced-filter/demo2/demo2.component',
      demoTitle: '宽度自适应',
      demoTitle_en: 'Width adaptation',
      demoDescription: '宽度随内容撑开，最大宽度为其父容器宽度。',
      demoDescription_en: 'The width is spread with the content, and the maximum width is the width of its parent ControlContainer.',
    },
    {
      demo: CustomComponent,
      codePath: 'showcase/advanced-filter/custom/custom.component',
      demoTitle: '自定义筛选值面板',
      demoTitle_en: 'Customize Filter Values Panel',
      demoDescription: '自定义筛选值面板显示内容。',
      demoDescription_en: 'Customize the display of the filter value panel.',
    },
  ],
  useRule: [],
  useSuggestion: [],
  mApi: [
    {
      selector: 'lv-advanced-filter',
      snippet: '<lv-advanced-filter [lvFields]="${1:fields}" [lvPlaceholder]="${2:placeholder}"></lv-advanced-filter>',
      name: 'lv-advanced-filter',
      name_en: 'lv-advanced-filter',
      api: [
        {
          attribute: 'lvFields',
          type: 'FieldItem[]',
          default: '',
          description: `
          综合筛选源数据。FieldItem属性如下：
          <ul>
            <li>[label: string] 过滤字段的显示值（可选）</li>
            <li>[field: string | number] 过滤字段（必选）</li>
            <li>[type: FieldType] 过滤字段配置项的类型（必选）</li>
            <li>[disabled?: boolean] 过滤字段是否禁用（可选）</li>
            <li>[option?: Record<string, any>] 过滤字段的过滤内容（可选）</li>
            <li>[defaultValue?: any] 默认过滤值（可选）</li>
            <li>[mode?: FilterMode] 过滤方式（可选）</li>
            <li>[searchDisable?: boolean] textInput包含搜索功能（可选）</li>
            <li>[[key: string]: any] 自定义属性</li>
          </ul>
          `,

          description_en: 'Comprehensive filtering source data.',
        },
        {
          attribute: 'lvWrap',
          type: 'boolean',
          default: 'false',
          description: '过滤回显内容是否自动换行。',
          description_en: 'Filter whether the echo content automatically wraps.',
        },
        {
          attribute: 'lvMaxTagRow',
          type: 'number',
          default: '3',
          description: '最大显示行数。',
          description_en: 'Maximum number of displayed rows.',
        },
        {
          attribute: 'lvPlaceholder',
          type: 'string',
          default: '',
          description: '占位文字。',
          description_en: 'Placeholder text.',
        },
        {
          attribute: 'lvTagMaxWidth',
          type: 'string',
          default: '100%',
          description: '标签最大宽度。',
          description_en: 'Maximum label width.',
        },
        {
          attribute: 'lvSearchable',
          type: 'boolean',
          default: 'true',
          description: '输入框允许搜索。',
          description_en: 'The search is allowed in the text box.',
        },
        {
          attribute: 'lvSearchKeyWordAble',
          type: 'boolean',
          default: 'true',
          description: '允许搜索关键字',
          description_en: 'Allow keyword to be searched.',
        },
        {
          attribute: 'lvSearchKeyWord',
          type: 'string',
          default: '关键字',
          description: '用户自定义关键字标签。',
          description_en: 'User-defined keyword label.',
        },
        {
          attribute: 'lvFilterPanelType',
          type: 'tree | normal',
          default: 'normal',
          description: '筛选面板类型。',
          description_en: 'Filter Panel Type.',
        },
        {
          attribute: 'lvCustomButton',
          type: 'TemplateRef<any>',
          default: '',
          description: '自定义按钮。',
          description_en: 'Custom Button.',
        },
        {
          attribute: 'lvTreeFiltersHeader',
          type: 'TemplateRef<any>',
          default: '',
          description: '自定义树形下拉面板头部模板。',
          description_en: 'Custom tree drop-down panel header template.',
        },
      ],
      event: [
        {
          event: 'lvOnChange',
          parameter: '{selectedFilters: FilterState[], currentFilter: FilterState}',
          description: '筛选器新增、修改、删除时的回调。',
          description_en: 'Callback function used when adding, modifying and deleting filters.',
        },
      ],
    },
  ],
};
